-
Notifications
You must be signed in to change notification settings - Fork 424
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ensure undefined script_env variables are undefined in multi-output build environment #5322
Conversation
CodSpeed Performance ReportMerging #5322 will not alter performanceComparing Summary
|
I've added an issue write-up (#5323), so this can be documented even if this specific PR isn't accepted. Thanks for your time and consideration. |
…uild into fix/undefined-env-vars
Thanks for the write-up. I think this looks good to go, but I wasn't involved in the mentioned PR. Tagging @msarahan and @kenodegard to see what they think. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
I've updated this to latest Is there anything else you'd like to see on this PR? More tests, docs, etc.? |
Most of the CI jobs are seeing a known failure, which happens outside this PR and is being debugged: #5426 The macOS Python 3.12 canary jobs see 2 failures. They appear unrelated to this PR (which has been passing in the past). Have raised them as issues:
Given there is support for this change and these issues appear unrelated, will go ahead and merge to fix this bug |
Description
Fixes #5323
"Use Environment Variables" in the
conda-build
docs says the following about variables inbuild.script_env
in recipes (my emphasis)(link)
As of #5105,
conda-build
does not behave that way for multi-output recipes. As of that PR, any variable mentioned in the recipe'sbuild.script_env
but not found in the environment whereconda-build
is called from will be set to the empty string''
in the build script environment.This PR proposes ensuring that such variables remain unset in the build script environment.
Thanks for your time and consideration.
Benefits of these changes
Removes a source of behavioral difference between top-level and multi-output builds.
Reduces a source of friction when using build scripts that are sensitive to the difference between environment variables being unset and being set to an empty string. (for example, with optional AWS credentials for
sccache
like this).Checklist - did you ...
news
directory (using the template) for the next release's release notes?How I tested this
The unit test I've added here fails on
main
.git checkout main -- conda_build/build.py pytest tests/test_subpackages.py::test_build_script_does_not_set_env_from_script_env_if_missing # Failed: DID NOT RAISE <class 'subprocess.CalledProcessError'>
And prints this message from the build script in stdout of the build process, showing that the unset environment variable is set to
''
.But passes on this branch.